home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GMS / GMSDev / Source / C / Fading / GreenFade.c next >
Encoding:
C/C++ Source or Header  |  1997-12-16  |  1.6 KB  |  55 lines

  1. /* Dice: dcc -l0 -mD dpk.o GreenFade.c -o GreenFade
  2. **
  3. ** Fades into a 32 colour picture.  Then fades up to a specified colour
  4. ** (lime green), and then out to black.  This demo will only work for
  5. ** pictures that make use of a palette table - ie it wouldn't work
  6. ** for a true colour screen.
  7. */
  8.  
  9. #include <proto/dpkernel.h>
  10.  
  11. BYTE *ProgName      = "GreenFade";
  12. BYTE *ProgAuthor    = "Paul Manias";
  13. BYTE *ProgDate      = "8 October 1997";
  14. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1997.  Freely distributable.";
  15. BYTE *ProgShort     = "Demonstration of screen fading.";
  16.  
  17. void main(void)
  18. {
  19.    WORD   FState=0;
  20.    struct GScreen *screen;
  21.    struct Picture *pic;
  22.    struct FileName PicFile = { ID_FILENAME, "GMS:demos/data/PIC.Loading" };
  23.  
  24.    if (pic = Load(&PicFile, ID_PICTURE)) {
  25.       screen = Get(ID_SCREEN);
  26.       CopyStructure(pic,screen);
  27.       screen->MemPtr1 = pic->Bitmap->Data;
  28.       screen->Palette = NULL;
  29.       screen->Attrib  = BLANKPALETTE;
  30.  
  31.       if (screen = Init(screen,NULL)) {
  32.          Display(screen);
  33.  
  34.          do {
  35.            WaitAVBL();
  36.            FState = ColourToPalette(screen,FState,2,0,screen->Bitmap->AmtColours,pic->Palette+2,0x000000);
  37.          } while (FState != NULL);
  38.  
  39.          do {
  40.            WaitAVBL();
  41.            FState = PaletteToColour(screen,FState,2,0,screen->Bitmap->AmtColours,pic->Palette+2,0xa5f343);
  42.          } while (FState != NULL);
  43.  
  44.          do {
  45.            WaitAVBL();
  46.            FState = ColourMorph(screen,FState,2,0,screen->Bitmap->AmtColours,0xa5f343,0x000000);
  47.          } while (FState != NULL);
  48.  
  49.       Free(screen);
  50.       }
  51.    Free(pic);
  52.    }
  53. }
  54.  
  55.